
<%@ page import="auctionhaus.Listing;auctionhaus.Bid"%>
<!doctype html>
<html>
<head>
<meta name="layout" content="main">
<g:set var="entityName"
	value="${message(code: 'listing.label', default: 'Listing')}" />
<title><g:message code="default.detail.label"
		args="[listingInstance?.name]" /></title>
		<g:javascript library="jquery" />
</head>
<body>
	<a href="#show-listing" class="skip" tabindex="-1"><g:message
			code="default.link.skip.label" default="Skip to content&hellip;" /></a>
	<div class="nav" role="navigation">
		<ul>
			<li><a class="home" href="${createLink(uri: '/')}"><g:message
						code="default.home.label" /></a></li>

		</ul>
	</div>
	<div id="show-listing" class="content scaffold-show" role="main">
		<h1>
			<g:message code="default.detail.label" args="[listingInstance?.name]" />
		</h1>
		<g:if test="${flash.message}">
			<div class="message" role="status">
				${flash.message}
			</div>
		</g:if>
		<ol class="property-list listing">

			<!-- L-1: The detail page for the listing shows the name of the listing -->
			<g:if test="${listingInstance?.name}">
				<li class="fieldcontain"><span id="name-label"
					class="property-label"><g:message code="listing.name.label"
							default="Name" /></span> <span class="property-value"
					aria-labelledby="name-label"><g:fieldValue
							bean="${listingInstance}" field="name" /></span></li>
			</g:if>

			<!-- L-2: The detail page for the listing shows the starting bid price of the listing -->
			<g:if test="${listingInstance?.startingPrice}">
				<li class="fieldcontain"><span id="startingPrice-label"
					class="property-label"><g:message
							code="listing.starting.price.label" default="Starting Price" /></span> <span
					class="property-value" aria-labelledby="startingPrice-label">${Bid.amountFormatter(listingInstance?.startingPrice)}</span></li>
			</g:if>

			<!--L-3: The detail page for the listing shows the most recent bid-->
		<g:if test="${listingInstance?.bids}">
			<li class="fieldcontain"><span id="bids-label"
				class="property-label"><g:message
						code="listing.recent.bids.label" default="Recent Bids" /></span> <%Bid b = listingInstance.bids.get(listingInstance.bids.size()-1 )%>

				<span class="property-value" aria-labelledby="bids-label"><g:remoteLink
						action="showRecentBids" controller="bid" update="returnedBids"
						params="[listingID: listingInstance?.id]">
						<g:message code="listing.show.recent.bids.label" default="Show" />
					</g:remoteLink>/<g:remoteLink action="hideRecentBids" controller="bid"
						update="returnedBids">
						<g:message code="listing.hide.recent.bids.label" default="Hide" />
					</g:remoteLink>
					<div id="returnedBids"></div> </span></li>



		</g:if>

			<li class="fieldcontain"><span id="bids-label"
				class="property-label"><g:message
						code="listing.numberOfBids.label" default="Number of Bids" /></span> <span
				class="property-value" aria-labelledby="bids-label"> ${listingInstance.bids.size()}</span>
			</li>

			<!--L-4: The detail page for the listing shows the end date/time of the listing-->
			<g:if test="${listingInstance?.endDateTime}">
				<li class="fieldcontain"><span id="endDateTime-label"
					class="property-label"><g:message
							code="listing.endDateTime.label" default="End Date Time" /></span> <span
					class="property-value" aria-labelledby="endDateTime-label"><g:formatDate
							date="${listingInstance?.endDateTime}" /></span></li>
			</g:if>

			<!-- L-5: The detail page for the listing optionally shows the description -->
			<g:if test="${listingInstance?.description}">
				<li class="fieldcontain"><span id="description-label"
					class="property-label"><g:message
							code="listing.description.label" default="Description" /></span> <span
					class="property-value" aria-labelledby="description-label"><g:fieldValue
							bean="${listingInstance}" field="description" /></span></li>
			</g:if>



			<!-- L-6: The detail page for the listing shows only the user portion of the email address of the user who created the listing (e.g. “mike” if the email address is “mike@piragua.com”) -->
			<g:if test="${listingInstance?.seller}">
				<li class="fieldcontain"><span id="seller-label"
					class="property-label"><g:message
							code="listing.seller.label" default="Seller" /></span> <span
					class="property-value" aria-labelledby="seller-label"><g:link
							controller="customer" action="show"
							id="${listingInstance?.seller?.id}">
							${listingInstance?.seller?.encodeAsHTML()}
						</g:link></span></li>
			</g:if>




			<g:if test="${listingInstance?.winner}">
				<li class="fieldcontain"><span id="winner-label"
					class="property-label"><g:message
							code="listing.winner.label" default="Winner" /></span> <span
					class="property-value" aria-labelledby="winner-label"><g:link
							controller="customer" action="show"
							id="${listingInstance?.winner?.id}">
							${listingInstance?.winner?.encodeAsHTML()}
						</g:link></span></li>
			</g:if>

		</ol>

	</div>
</body>
</html>
